﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gota.Common.Context;

namespace Gota.Common.Entities.UI
{
    [Serializable]
    public class GazetteerCategoryEntity
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string ParentName { get; set; }
        public string ResourceName { get; set; }
        public string CategoryName { get; set; }

        public static GazetteerCategoryEntity FromDB(GazetteerCategory gc)
        {
            GazetteerCategoryEntity ge = new GazetteerCategoryEntity
            {
                Id = gc.Id,
                Name = gc.Name,
                ParentName = gc.ParentId.HasValue ? gc.GazetteerCategory1.Name : String.Empty,
                ResourceName = gc.ResourceName,
                CategoryName = gc.CategoryName
            };
            return ge;
        }
    }
}
